package com.timmy.mvpdemo.presenter;

import com.timmy.mvpdemo.interfa.RequestView;
import com.timmy.mvpdemo.interfa.TestCallback;
import com.timmy.mvpdemo.model.RequestMode;

/**
 * Created by Timmy on 2017/12/10.
 */

public class MainActivityPresenter {
    private final RequestView mRequestView;
    private final RequestMode mRequestMode;

    public MainActivityPresenter(RequestView requestView) {
        this.mRequestView = requestView;
        this.mRequestMode = new RequestMode();
    }

    public void clickRequest() {

        mRequestView.requestLoading();

        mRequestMode.request(new TestCallback() {
            @Override
            public void onSuccess() {
                mRequestView.resultSuccess("成功");
            }

            @Override
            public void onFaild() {
                mRequestView.resultFailure("失败");
            }
        });
    }
}
